<?php 

	require_once('./template/header.tpl.php');

	include('./src/connect.php');
	include('./src/config.php');
	$teacher = $_GET['teacher'];
	
	$query = "SELECT * FROM ark_courseperiod cp LEFT OUTER JOIN ark_course c ON cp.cid=c.id WHERE cp.teacher='$teacher' ORDER BY weekday,period_from";
	if ($result = mysql_query($query, $link)) {
		while ($res = mysql_fetch_array($result)) {
			print "<div id='box'><ul>"
				."<li>".$res['teacher']."</li>"
				."<li>".$res['name']."</li>"
				."<li>".$weekday[$res['weekday']]."</li>"
				."<li>第".$res['period_from']."小节 <<->> 第".$res['period_to']."小节</li>"
				."<li>课程号：".$res['cid']."</li>"
				."<li>课序号：".$res['serial']."</li>"
				."</ul></div>";
		}
	}
	else {
		exit("No matched data");
	}

	require_once('./template/footer.tpl.php');
?>